# #if-else用法
# if 5>12:
#     print("5 is greater than 2")
#     print("222222")
# else:
#     print("5 is not greater than 2")

age = 30
if age < 18:
    print("你是未成年人")
elif 30 > age >= 18:
    print("你是青少年")
elif 50 > age >= 30:
    print("你是一个中年人")
else:
    print("你是老年人")

# 判断闰年
# year = int(input("请输入一个年份："))
# if (year % 4 == 0 or year % 100 != 0) or (year % 400 == 0):
#     print(f"{year}是一个闰年")
# else:
#     print("%d不是闰年" % year)

# 使用if判断三个数的最大数
# a = int(input("请输入a:"))
# b = int(input("请输入b:"))
# c = int(input("请输入c:"))
#
# if a > b:
#     if a > c:
#         print("a最大")
#     else:
#         print("c最大")
# else:
#     if b > c:
#         print("b最大")
#     else:
#         print("c最大")

# 计算器实现加减乘除
# num1 = float(input("请输入第一个数："))
# num2 = float(input("请输入第二个数："))
# op = input("请输入一个运算符：")
# if op == "+":
#     print(num1 + num2)
# elif op == "-":
#     print(num1 - num2)
# elif op == "*":
#     print(num1 * num2)
# elif op == "/":
#     print(num1 / num2)
# else:
#     print("输入错误！")
#
# for i in range(10):
#     print(i, end=" ")

# 猜数字
# 生成0到20的随机数
# r = random.randint(1, 100)
# count = 0
# while True:
#     guess = int(input("请猜测一个0-20的整数"))
#     if guess == r:
#         print("猜对了")
#         print(f'你一共猜了{count}次')
#     if guess > r:
#         print("猜大了")
#         count += 1
#     if guess < r:
#         print("猜小了")
#         count += 1

# 一百以内逢7过
for i in range(1,100):
    if i % 7 == 0 or str(i).find('7') != -1:
        # if i % 7 == 0 or str(i).count('7') > 0:
        # if i % 7 == 0 or '7' in str(i) != -1:
        print(i, end=" ")
print()
# 打印菱形
for i in range(1, 12, 2):
    print(("*" * i).center(11))
# center 方法，使字符串居中
for i in range(9, 0, -2):
    print(("*" * i).center(11))

# 打印菱形嵌套循环
# 打印一百以内的质数，